package com.CuiChangHe.studentmanager.controller;

import com.CuiChangHe.studentmanager.entity.login.Login;
import com.CuiChangHe.studentmanager.entity.login.LoginReturnMsg;
import com.CuiChangHe.studentmanager.entity.login.Logout;
import com.CuiChangHe.studentmanager.service.login.UserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description :登录Controller
 * @Author :崔昌赫
 * @Date : 2021/11/16
 */
@RestController
public class LoginController {

    private UserLoginService userLoginService;

    @Autowired
    public void setUserLogin(UserLoginService userLoginService) {
        this.userLoginService = userLoginService;
    }

    @PostMapping("/login")
    public LoginReturnMsg login(@RequestBody Login login){
        return userLoginService.login(login);
    }

    @PostMapping("/logout")
    public Logout logout(){return userLoginService.logout();}

}
